module.exports = {
  validForm:async function(form){
    let that=this;
    const vailed=new Promise((resolve,reject)=>{
      that.selectComponent(form).validate((valid, errors) => {
          if (!valid) {
              const firstError = Object.keys(errors)
              if (firstError.length) {
                that.setData({error: errors[firstError[0]].message})
              }
              reject(0);
          }else{
            resolve(1);
          }
      })
    })
    return await vailed||0;
  }
};